
<html>
 
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="public/css.css" rel="stylesheet" type="text/css" />
        
        <title>Huy Bee</title>
    </head>
    <body>
        <div class="chung">
        <h1 align="center">Words</h1>
<?php
require_once './class/db.php';
require_once './class/keywords.php';
require_once './class/words.php';
?>
<?php
//Em chua lam tinh nang: edit cho working dung ko?
//da
//:p 0 diem nhe' :adx
//ok?
//tu tu thay oi
//:D co 1 tuan roi em oi :D, cai nay o web1 em lam roi ma
$keywords = new words();
$list= $keywords->selects();
?>
 <div class="hinh"></div> 
 <div class="menu">
 <ul>
     <li>
         <a href="#">Trang Chủ</a>
     </li>
      <li>
         <a href="#">Diễn Đàn</a>
     </li>
      <li>
         <a href="#">Giới Thiệu</a>
     </li>
      <li>
         <a href="#">Liên Hệ</a>
     </li>
 </ul>
   </div>      
        
        
    <from method='GET'> 
         
        <?php
        $page =1;
        if (isset($_GET['page']))            
        $page = $_GET['page'];?>
    <a href='word.php?page=<?php echo $page['page']-1?>'> Prew</a>
    <a href='word.php?page=1'> First</a>
    <?php
    
    $page = 10;
   
    if ((isset($_GET['page'])) &&($page['page'] <= 3)) {
        for ($i = 1; $i <= $page; $i++) {
            ?> 
            <a href='word.php?page=<?php echo $i ?>'><?php echo $i ?></a>
        <?php
        }
    } else if ((isset($_GET['page'])) &&($page['page'] >= 17)) {
        for ($i = 15; $i <= 19; $i++) {
            ?> 
            <a href='word.php?page=<?php echo $i ?>'><?php echo $i ?></a>
        <?php }
    } else if (isset($_GET['page'])) {
        for ($i = ($_GET['page'] - 3); $i <= ($_GET['page'] + 3); $i++) {
            ?>
            <a href='word.php?page=<?php echo $i ?>'><?php echo $i ?></a>
    <?php }
    
} ?>
    <a href='word.php?page=19'>Last</a>
    <?php
        $page =1;
        if (isset($_GET['page']))            
        $page = $_GET['page'];?>
     <a href='word.php?page=<?php echo $page['page']+1?>'> Next </a>
</table>


  

</from>
 <div class="thanh"></div>
        <?php
        $page =1;
        if (isset($_GET['page']))            
        $page = $_GET['page'];
        $from = PER_PAGE*($page-1);
        $to=PER_PAGE;
        $query = "SELECT * FROM works LIMIT $from ,$to";
        $list = $keywords->select($query);
        ?>
    </from>
     <table border="1px">
            <tr class="a1">
                <td>ID</td>
                <td>NAME</td>
                <td>IMAGE</td>
                <td>URL</td>
                
                <td>EDIT</td>
            </tr>
            <?php foreach ($list as $lists) :?> 
            <tr>
                <td><?php echo $lists['id']; ?></td>
                <td><?php echo $lists['name']; ?></td>
                <td><img src="<?php echo $lists['image'] ?>" with="100px" height="100px"></td>
                <td><a href='<?php echo $lists['url'];?>'><?php echo $lists['url'];?></td>
                <td class="dk">
                    <img src="public/images/UniversalEditButton3-22230410.png" width="15px" height="15px"><a href="edit.php?id=<?php echo $lists['id']; ?>">Edit</a><br>
                    <img src="public/images/Zoom_in.png" width="15px" height="15px"><a href="edit.php?id=<?php echo $lists['id']; ?>">View</a><br>
                    <img src="public/images/2629515-366279-delete-metallic-3d-vibrant-round-icon.jpg" width="15px" height="15px"><a href="edit.php?id=<?php echo $lists['id']; ?>">Delete</a><br>
                </td>
                </tr>
            <?php endforeach;?>
        </table>

    
    <div><h1 align="center">Nguyễn Trường Huy-C12TDT</h1></div>

    
   <div class="cuoi"></div>   
</body>
        
</html>